home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / freemcb.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  933b  |  44 lines

  1. /*
  2.   Free the MCBs
  3.  
  4.   Function: This procedure frees all the MCBs which are belong to
  5.             LU module.
  6.  
  7.   CopyRight 1995. Nicholas Poljakov all rights reserved.
  8.  
  9.  */
  10.  
  11. #include <dos.h>
  12.  
  13. extern unsigned ProgPrefix;
  14.  
  15. freeMCB()
  16. {
  17.     unsigned int seg_mcb;
  18.         struct mcb {
  19.                 unsigned char type;
  20.                 unsigned int  Owner;
  21.                 unsigned int  size;
  22.         } *p_mcb;
  23.  
  24.         _asm {
  25.                 mov  ax, 5200h
  26.                 int  21h
  27.                 mov  ax, word ptr es:[bx - 2]
  28.         mov  word ptr seg_mcb[0], ax
  29.         }
  30.  
  31.     FP_SEG( p_mcb ) = seg_mcb;
  32.         FP_OFF( p_mcb ) = 0;
  33.  
  34.         while (p_mcb -> type == 0x4d) { /* middle MCB */
  35.             if (p_mcb -> Owner == ProgPrefix) {
  36.           _dos_freemem( seg_mcb + 1 );
  37.             }
  38.         seg_mcb += p_mcb -> size;
  39.         seg_mcb++;
  40.         FP_SEG( p_mcb ) = seg_mcb;
  41.         FP_OFF( p_mcb ) = 0;
  42.         }
  43. }
  44.